# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
cmake_minimum_required(VERSION 3.5)
project(kinextdk_cal LANGUAGES C CXX)


############################
#### AZURE KINECT SDK ######
############################

message("Finding K4A SDK binaries")

# Disable cached locations for K4A SDK binaries.
# Do this to force the search logic to happen correctly.
# If we don't disable these cached directories, we
# won't be able to tell the difference between the ext/sdk location
# and the system installed version on linux. Since we have to treat these
# differently (one needs install, one doesn't) we must disable the cache
# so that find_package(k4a) will fail in all cases if not installed via the .deb.
unset(k4a_DIR CACHE)

# Force running the Findk4a.cmake module
find_package(k4a  REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
set(K4A_LIBS k4a::k4a;k4a::k4arecord)

set(Eigen_DIR ${EIGEN3_INCLUDE_DIR})
IF( NOT EIGEN3_INCLUDE_DIR )
    MESSAGE( FATAL_ERROR "Please point the environment variable EIGEN3_INCLUDE_DIR to the include directory of your Eigen3 installation.")
ENDIF()
# This reads the K4A_LIBS and K4A_INSTALL_REQUIRED variables and decides how to install
# the various shared objects / DLLs

##################################
###### END AZURE KINECT SDK ######
##################################
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(/usr/local/include/aruco)

include_directories(${EIGEN3_INCLUDE_DIR})
include_directories(${ArUco_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})

add_executable(aruco_calibrition Source_TwoKinects_Calibration.cpp)
target_link_libraries(aruco_calibrition 
			PRIVATE 
			aruco
			k4a::k4a 
			Eigen3::Eigen 
			${OpenCV_LIBS}
			${ArUco_LIBRARIES})
